package com.cc.core;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author CongWT
 * @date 2018年6月12日 下午5:10:21
 * @read "数据源注入"
 */
public class MultipleDataSource extends AbstractRoutingDataSource {
	
	public static final String dataSource = "dataSource";  
    public static final String dataSourceSSO = "dataSourceSSO";  
    public static final String dataSourceSALES = "dataSourceSALES";  
      
    private static final ThreadLocal<String> dataSourceKey = new InheritableThreadLocal<String>();  
  
    public static void setDataSourceKey(String dataSource) {  
        dataSourceKey.set(dataSource);  
    }  

	@Override
	protected Object determineCurrentLookupKey() {
		return dataSourceKey.get();
	}

}
